<?php
/*  
  Copyright (c) 2010-02 SongCMS 
  SongCMS All Rights Reserved. 
  Support:www.SongCMS.com
  QQ:544255858   19951025
  Author:Song  Version:3.17
  Date:2010-08-12 09:28:32
*/
$user = new user();
$Ue = $user -> member();
$SC -> assign('Ue',$Ue);
if(!empty($_POST['UserPassword'])){
	if (!External()) MsgBox(1,$Warning[15],'-1');
	include_once('plugins/ucenter/config.inc.php');
	if(UC_ENABLED == 1){
		include_once('plugins/ucenter/uc_client/client.php');
		switch(uc_user_edit($_COOKIE['User']['Name'],'',$_POST['UserPassword'],$_POST['UserEmail'],1,$_POST['UserProtectionQuestion'],$_POST['UserProtectionAnswer'])){
			case 1 : break; 
			case 0 : break; 
			case -1 : break; 
			case -4 : MsgBox (1,'Email 格式有误','-1'); break;
			case -5 : MsgBox (1,'Email 不允许注册','-1');break; 
			case -6 : MsgBox (1,'该 Email 已经被注册','-1');break;
			case -7 : break; 
			case -8 : MsgBox (1,'该用户受保护无权限更改','-1');break;
		}
	}
	$UserPassword = $_POST['UserPassword'] == $Ue['UserPassword'] ? $_POST['UserPassword'] : md5($_POST['UserPassword']);
	$SQL = "UPDATE `{$dbprefix}user` SET 
	`UserPassword` = '" . $UserPassword . "',
	`UserProtectionQuestion` = '" . $_POST['UserProtectionQuestion'] . "',
	`UserProtectionAnswer` = '" . $_POST['UserProtectionAnswer'] . "',
	`UserTrueName` = '" . $_POST['UserTrueName'] . "',
	`UserSex` = '" . $_POST['UserSex'] . "',
	`UserEmail` = '" . $_POST['UserEmail'] . "',
	`UserCompany` = '" . $_POST['UserCompany'] . "',
	`UserWeb` = '" . $_POST['UserWeb'] . "',
	`UserAddress` = '" . $_POST['UserAddress'] . "',
	`UserTel` = '" . $_POST['UserTel'] . "',
	`UserFax` = '" . $_POST['UserFax'] . "' WHERE `UserName` = '{$Ue['UserName']}' LIMIT 1; ";
	$SC -> cache -> clearAll();
	$db = new db();
	if($db->ExecuteSQL($SQL)){
		MsgBox (1,$Warning[20],'1');
	} else {
		MsgBox (1,$Warning[18],'-1');
	}
}
$pfe['pfTitle'] = $Html['Modify'];
$pfe['Action'] = 'UpDate';
$SC -> assign('pfe',$pfe);
$product = new product();
$product -> Lang = $Lang;
$product -> Ltext = $Html['page'];
$SC -> register -> templateObject("product",$product);
$news = new news();
$news -> Lang = $Lang;
$news -> Ltext = $Html['page'];
$SC -> register -> templateObject("news",$news);
$article = new article();
$article -> Lang = $Lang;
$article -> Ltext = $Html['page'];
$SC -> register -> templateObject("article",$article);
$SC -> register -> templateObject("sdb",$sdb);
$TemFile = 'reg'.$TemplateSuffix;
include_once('top.php');
include_once('bottom.php');
$SC -> display($TemFile,$GetUrlPar);
?>